package com.banksoft.cps.controller.company;

import com.banksoft.cps.bean.Material;
import com.banksoft.cps.bean.query.MaterialQuery;
import com.banksoft.cps.controller.ControllerConstants;
import com.banksoft.cps.enums.Status;
import com.banksoft.cps.service.MaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by rongzhao.zhu on 2018/1/12.
 */
@Controller
@RequestMapping("/company/material/")
public class CMaterialController extends ControllerConstants {
    @Autowired
    MaterialService materialService;
    @RequestMapping(value = "listAll", produces = "application/json;charset=utf-8")
    @ResponseBody
    public String listAll(){
        MaterialQuery query = new MaterialQuery();
        List<Material> list =  materialService.list(query);
        return toJSONString(createDataTip(list));
    }
}
